package com.gw2.gw2world.web.server.model;


import org.json.JSONException;
import org.json.JSONObject;

public class Server {
	public static enum Region {NORTH_AMERICA, EUROPE};
	private int id;
	private Region region;
	public Server(int server_id) {
		setId(server_id);
	}
	public int getId() {
		return id;
	}
	public void setId(int id) {
		this.id = id;
		if(id<2000) region=Region.NORTH_AMERICA;
		else region=Region.EUROPE;
	}
	public Region getRegion() {
		return region;
	}
	public static String getJsonWithRegion(JSONObject o) throws JSONException {
		if(o.getInt("world_id")<2000) o.put("region", "na");
		else o.put("region", "eu");
		return o.toString();
	}
	public static JSONObject getJsonObjectWithRegion(JSONObject o) throws JSONException {
		if(o.getInt("world_id")<2000) o.put("region", "na");
		else o.put("region", "eu");
		return o;
	}
}
